#include "../include/AccountReport.h"


AccountReport::AccountReport()
	: Report(), _userId() {};

AccountReport::AccountReport(const Poco::DateTime * const date, int id)
	: Report(date), _userId(id) {}

AccountReport::~AccountReport() {
	delete date;
}

Events::eEvents AccountReport::getType() const {
	return type;
}

//returns posotive int if this happens before other;
//negative if other happens before this; 0 otherwise.
//Two AccountReport's of same date and user, are equal
int AccountReport::compareTo(Events & other) const {
	int ans = 0;
	ans = (*(other.date) - *(this->date)).days(); //compare dates
	if (ans == 0) {//dates are the same
		ans = other.getType() - this->type;//compare event type
		if (ans == 0) { //event types are the same
			const AccountReport &otherReport = dynamic_cast<AccountReport&>(other); //cast other to AccountReport
			ans = otherReport._userId - this->_userId; //compare user id
		}
	}
	return ans;
}
